package com.yuexun.beilunpatient.ui.inspect.presenter.impl;

import com.yuexun.beilunpatient.base.BaseEntity;
import com.yuexun.beilunpatient.ui.inspect.bean.CheckDtlRowSet;
import com.yuexun.beilunpatient.ui.inspect.model.IInspectDetailModel;
import com.yuexun.beilunpatient.ui.inspect.presenter.IInspectWeblPresenter;
import com.yuexun.beilunpatient.ui.inspect.ui.view.IInspectDetailView;
import com.yuexun.beilunpatient.ui.inspect.ui.view.IInspectWeblView;

import org.kymjs.kjframe.ui.ViewInject;

import rx.Subscriber;
import rx.android.schedulers.AndroidSchedulers;
import rx.schedulers.Schedulers;

/**
 * Created by Administrator on 2019/5/6 0006.
 */

public class InspectWeblPresenter implements IInspectWeblPresenter{
    private IInspectDetailModel model;
    private IInspectWeblView view;

    public InspectWeblPresenter(IInspectWeblView view, IInspectDetailModel model) {
        this.view = view;
        this.model = model;
    }

    @Override
    public void cIcheckInfoMobileWeb(String sessionUuidPatient, String pageSize, String pageIndex, String accessionNumber, String OrganizationID, String ExamType) {
        model.cIcheckInfoMobileWeb(sessionUuidPatient,pageSize,pageIndex,accessionNumber,OrganizationID,ExamType)
                .subscribeOn(Schedulers.io())
                .observeOn(AndroidSchedulers.mainThread())
                .subscribe(new Subscriber<BaseEntity<String>>() {
                    @Override
                    public void onCompleted() {
                        view.dismiss();
                    }

                    @Override
                    public void onError(Throwable e) {
                        ViewInject.toast("获取影像地址失败:"+e.getMessage());
                    }

                    @Override
                    public void onNext(BaseEntity<String> bean) {
                        view.showInspectWeb(bean);
                    }
                });
    }
}
